﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mysql = MySql.Data.MySqlClient;

namespace MySQLTestApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Server=127.0.0.1;Uid=root;Pwd=password;Database=database;";
            using (mysql.MySqlConnection connection = new mysql.MySqlConnection(connectionString))
            {
                using (mysql.MySqlCommand command = new mysql.MySqlCommand("Select * from userTable", connection))
                {
                    connection.Open();
                    var reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        Console.WriteLine(string.Format("Name: {0} UserName: {1}", (string)reader[1], (string)reader[2]));
                    }
                }
                Console.ReadLine();
            }
        }
    }
}
